package com.lyzd.dbtools.service;

import com.lyzd.dbtools.dao.MySqlDAO;
import com.lyzd.dbtools.entity.Column;
import com.lyzd.dbtools.entity.DataBase;
import com.lyzd.dbtools.entity.Index;
import com.lyzd.dbtools.entity.Table;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@AllArgsConstructor
@Service
public class MySqlService {
    private final MySqlDAO mySqlDAO;

    public List<DataBase> queryAllDataBase() {
        return mySqlDAO.queryAllDataBase();
    }

    public List<Table> queryTablesByDbName(String dbName) {
        return mySqlDAO.queryTablesByDbName(dbName);
    }

    public List<Column> queryColumnByDbAndTableName(String dbName, String tableName) {
        return mySqlDAO.queryColumnByDbAndTableName(dbName, tableName);
    }

    public List<Index> queryIndexByDbAndTableName(String dbName, String tableName) {
        return mySqlDAO.queryIndexByDbAndTableName(dbName, tableName);
    }
}
